<%inherit file="message_base.html" />

<%block name="sidemain">

% if TOTAL:
<div id="ly-inbox-list" class="ly-message-list">
  <p class="global-info">${ _("Inbox have %s message.") % TOTAL } </p>
  <table>
    <thead>
      <tr>
        <th>${ _("From") }</th>
        <th>${ _("Subject") }</th>
    <th></th>
      </tr>
    </thead>
    <tbody>
      % for M in MESSAGE_LIST:
      <% newmsg = '' if M.isread else 'new-message' %>
      <tr class="${ newmsg }">
        <td class="sender user">
      <a href="${ reverse_url('user:view') }?id=${ M.sender_id }" target="_blank"><img src="${ M.sender.avatar_url }" /></a>
      <a href="${ reverse_url('user:view') }?id=${ M.sender_id }" target="_blank">${ M.sender.username }</a>
    </td>
        <td class="subject">
      <div><a href="${ reverse_url('message:view', M.id) }">${ M.text.subject }</a></div>
      <div class="timestamp">${ htime(M.text.sendtime) }</div>
    </td>
        <td class="other">
      <div class="management hide" style="display: none;">
        <a class="green-submit" href="${ reverse_url('message:reply', M.id) }">${ _("Reply") }</a>
        <a class="delete-message red-submit" href="${ reverse_url('message:delete', M.id) }">${ _("Delete") }</a></div>

    </td>
      </tr>
      % endfor
    </tbody>
  </table>
  ${ PAGE_HTML }
</div>
% else:
<p class="ywarn">${ _("You have not receiverd any message yet !") }</p>
% endif

<script type="text/javascript">
  hoverShowHide(".ly-message-list tbody > tr");

  aClickConfirm(".delete-message", {
    title: "${ _("Delete Message") }",
    text: "${ _("Wail ! the message will lost !") }",
    ok: "${ _("I am sure !") }",
    cancel: "${ _("Cancel") }",
  });
</script>

</%block>
